# docker-compose up -d    适用于所有组件在一台服务器上
version: "3.8"

services:
  mysql8:
    image: mysql:8.0
    container_name: mysql8
    restart: always
    volumes:
      - "./mysql/my.cnf:/etc/mysql/my.cnf"
      - "./mysql/data:/var/lib/mysql"
      - "./mysql/mysql-files:/var/lib/mysql-files"
    environment:
      TZ: Asia/Shanghai
      LANG: en_US.UTF-8
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: ${contextPath}
    privileged: true
    user: root
    ports:
      - "3306:3306"

  ${contextPath}:
    container_name: ${contextPath}
    build:
      context: ./
      dockerfile: Dockerfile
    ports:
      - "8082:8082"
    depends_on:
      - mysql8
    restart: always
    volumes:
      - "./logs:/logs"